Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement seal_debug_message #792

Merged
merged 31 commits into from
Jun 9, 2021
Merged

Implement seal_debug_message #792

merged 31 commits into from
Jun 9, 2021

Conversation

ascjones
Copy link
Collaborator

@ascjones ascjones commented May 14, 2021

Companion PR for paritytech/substrate#8773, which replaces seal_println with seal_debug_message.

I've added some convenience macros debug_print! and debug_println!, let me know what you think.

todo

  • Test it against latest substrate.
  • Find and update any docs relating to legacy println! Update docs about println ink-docs#19
  • Since seal_debug_message is now an unstable feature in the contracts pallet, should we hide it behind ink-unstable? Or just add a comment that the node needs to compiled with "pallet-contracts/unstable-interface" enabled.
  • Add ink-debug feature which makes debug_message and the debug_print* macro a noop. Could modify cargo-contract to add/remove this feature from the contract/

@Robbepop
Copy link
Collaborator

I've added some convenience macros debug_print! and debug_println!, let me know what you think.

Let's be honest: It was about time. 😅

Copy link
Collaborator

@Robbepop Robbepop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all in all LGTM

crates/env/src/backend.rs Show resolved Hide resolved
crates/env/src/lib.rs Outdated Show resolved Hide resolved
crates/env/src/lib.rs Outdated Show resolved Hide resolved
crates/env/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@Robbepop Robbepop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, we can merge soon.

crates/env/src/backend.rs Outdated Show resolved Hide resolved
crates/env/src/lib.rs Outdated Show resolved Hide resolved
@ascjones ascjones marked this pull request as ready for review May 20, 2021 15:49
@Robbepop
Copy link
Collaborator

Since seal_debug_message is now an unstable feature in the contracts pallet, should we hide it behind ink-unstable? Or just add a comment that the node needs to compiled with "pallet-contracts/unstable-interface" enabled.

I personally wouldn't introduce yet another crate feature and instead document the expected behavior when using this SEAL macro/function without respecting the SEAL unstable feature upon compilation.

crates/env/src/engine/on_chain/ext.rs Outdated Show resolved Hide resolved
crates/env/src/engine/on_chain/ext.rs Outdated Show resolved Hide resolved
crates/env/src/engine/on_chain/ext.rs Outdated Show resolved Hide resolved
@athei athei mentioned this pull request May 22, 2021
crates/env/src/lib.rs Outdated Show resolved Hide resolved
@ascjones ascjones merged commit 2458e0c into master Jun 9, 2021
@ascjones ascjones deleted the aj-debug-message branch June 9, 2021 08:26
#[cfg(feature = "ink-debug")]
/// Call `seal_debug_message` with the supplied UTF-8 encoded message.
///
/// If debug message recording is disabled in the contracts pallet, the first call to will
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// If debug message recording is disabled in the contracts pallet, the first call to will
/// If debug message recording is disabled in the contracts pallet, the first call will

/// Call `seal_debug_message` with the supplied UTF-8 encoded message.
///
/// If debug message recording is disabled in the contracts pallet, the first call to will
/// return LoggingDisabled error, and further calls will be a no-op to avoid the cost of calling
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please make it LoggingDisabled. somehow I cannot make a suggestion here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah sorry because I merged it already 🙈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants